﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Assessment.Management.SharedComponent.Params.ManagerParam;

namespace Assessment.Management.DAO.CommonManagers
{
    public class TeacherClassDAO : BaseDaos
    {
        public TeacherClassDAO()
            : base()
        {
        }

        public void CreateTeacherClass(TeacherClassParam param)
        {
            string query = @"Insert into Teacher_Class (TeacherID, ClassID, SubjectID, CreatedBy, CreatedDTG, Deleted, Version) 
                                        values(@TeacherID, @ClassID, @SubjectID, @CreatedBy, @CreatedDTG, @Deleted, @Version)";

            var cmd = base.GetSqlCommand();
            cmd.CommandText = query;
            cmd.Parameters.AddWithValue("@TeacherID", param.TeacherClass.TeacherID);
            cmd.Parameters.AddWithValue("@ClassID", param.TeacherClass.ClassID);
            cmd.Parameters.AddWithValue("@SubjectID", param.TeacherClass.SubjectID);
            cmd.Parameters.AddWithValue("@CreatedBy", param.TeacherClass.CreatedBy);
            cmd.Parameters.AddWithValue("@CreatedDTG", param.TeacherClass.CreatedDTG);
            cmd.Parameters.AddWithValue("@Deleted", param.TeacherClass.Deleted);
            cmd.Parameters.AddWithValue("@Version", param.TeacherClass.Version);

            try
            {
                int count = base.ExecuteNonQuery(cmd);
            }
            finally
            {
                base.CloseConnection(cmd);
            }
        }
    }
}
